Skip to content

Switch from jose to cloudflare-worker-jwt#33

Closed
skaldebane wants to merge 2 commits intofinsweet:masterfrom
skaldebane:workers-jwt
Closed

Switch from jose to cloudflare-worker-jwt#33
skaldebane wants to merge 2 commits intofinsweet:masterfrom
skaldebane:workers-jwt

Conversation

@skaldebane
Copy link

I've had many issues with fireworkers with Cloudflare Pages (in a SvelteKit project).

At build time (on deployment), the build fails due to lack of CryptoKey, which is extremely weird.

image

However, I found a workaround inspired by panva/jose#411 (not included in this PR), by polyfilling CryptoKey from @peculiar/webcrypto before calling Fireworkers.init(...).

import { CryptoKey } from "@peculiar/webcrypto";
globalThis.CryptoKey = CryptoKey;

However, this fix only works when using @tsndr/cloudflare-worker-jwt, while jose complains about CryptoKey not being the same as the one it expects.

I'm currently using this version in a real app and it works flawlessly.

While jose should normally work just fine on any environment, cloudflare-worker-jwt is a pretty solid replacement, especially that fireworkers is targeting Cloudflare Workers specifically.

Maybe I'm missing something here, so it's okay if you refuse this change!

@alexiglesias93
Copy link
Member

I just updated the jose dependency version from 4.11.2 to 5.9.6 in #42. Can you let me know if after this upgrade the issue still persists? If yes, I'll merge this PR.

@skaldebane
Copy link
Author

skaldebane commented May 10, 2025

Sorry for the late response, as I don't use Firebase anymore, and kept delaying this forever 😅

Just tried the latest version on a dummy project, and it works perfectly, without needing any hacks!

@skaldebane skaldebane closed this May 10, 2025
@alexiglesias93
Copy link
Member

Sorry for the late response, as I don't use Firebase anymore, and kept delaying this forever 😅

Just tried the latest version on a dummy project, and it works perfectly, without needing any hacks!

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants